import request from '@/utils/request'

export function selectKnowledgeList(query){
  return request({
    url: '/knowledge/list',
    method: 'get',
    params: query
  })
}

export function selectPublicKnowledgeList(query){
  return request({
    url: '/knowledge/selectPublicKnowledgeList',
    method: 'get',
    params: query
  })
}

export function searchKnowledgeList(searchValue){
  return request({
    url: '/knowledge/selectKnowleges/' + searchValue,
    method: 'get'
  })
}

export function selectKnowledgeById(id){
  return request({
    url: '/knowledge/selectKnowledgeById/' + id,
    method: 'get'
  })
}

export function insertKnowledge(data){
  return request({
    url: '/knowledge',
    method: 'post',
    data: data
  })
}

export function updateKnowledge(data){
  return request({
    url: '/knowledge',
    method: 'put',
    data: data
  })
}

export function deleteKnowledgeById(id){
  return request({
    url: '/knowledge/' + id,
    method: 'delete'
  })
}

export function uploadFile(data){
  return request({
    url: '/knowledge/uploadFile',
    method: 'post',
    data: data
  })
}

export function uploadAttachFile(data){
  return request({
    url: '/knowledge/uploadAttachFile',
    method: 'post',
    data: data
  })
}

export function deleteAttachFile(data) {
  return request({
    url: '/knowledge/deleteAttachFile',
    method: 'post',
    data: data
  })
}
